{% extends "admin/change_form.html" %}
{% load static admin_list admin_urls %}

{% block submit_buttons_bottom %}
    {{ block.super }}
    <div class="submit-row">
        <div class="align-left">
            {% comment %}
              Add custom buttons for the actions we want on the change form.
              They have to be *after* the other submit buttons, otherwise they
              could become the default submit button of the page
            {% endcomment %}
            {% if has_users_edit_permission %}
                <input formaction="{% url 'admin:users_userprofile_ban' original.pk|admin_urlquote %}"
                       type="submit" value="Ban"  {% if original.banned %}disabled="disabled"{% endif %}/>
                <input formaction="{% url 'admin:users_userprofile_unban' original.pk|admin_urlquote %}"
                       type="submit" value="Unban" {% if not original.banned %}disabled="disabled"{% endif %}/>
                <input formaction="{% url 'admin:users_userprofile_reset_api_key' original.pk|admin_urlquote %}"
                       type="submit" value="Reset API Key" />
                <input formaction="{% url 'admin:users_userprofile_reset_session' original.pk|admin_urlquote %}"
                       type="submit" value="Reset session(s)" />
            {% endif %}
            <input formaction="{% url 'admin:users_userprofile_delete_picture' original.pk|admin_urlquote %}"
                   type="submit" value="Delete picture" />
        </div>
    </div>
{% endblock %}
